package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Eleventh_a;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Eleventh_aMapper {

    @Select({
            "select",
            "*",
            "from Eleventh_a",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Eleventh_a> selectByName(String oName);
    @Delete({
            "delete from Eleventh_a",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);
    int insertBatch(List<Eleventh_a> item);
    @Delete({
        "delete from eleventh_a",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into eleventh_a (hospital, item, ",
        "object, count, pay)",
        "values (#{hospital,jdbcType=VARCHAR}, #{item,jdbcType=VARCHAR}, ",
        "#{object,jdbcType=VARCHAR}, #{count,jdbcType=VARCHAR}, #{pay,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(Eleventh_a record);

    int insertSelective(Eleventh_a record);

    @Select({
        "select",
        "id, hospital, item, object, count, pay",
        "from eleventh_a",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Eleventh_a selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Eleventh_a record);

    @Update({
        "update eleventh_a",
        "set hospital = #{hospital,jdbcType=VARCHAR},",
          "item = #{item,jdbcType=VARCHAR},",
          "object = #{object,jdbcType=VARCHAR},",
          "count = #{count,jdbcType=VARCHAR},",
          "pay = #{pay,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Eleventh_a record);
}